package cn.ac.siom.query.action;

import cn.ac.siom.query.service.IInfoMessageService;
import cn.ac.siom.query.util.action.DefaultAction;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/8/14 0014.
 */
@CrossOrigin
@Controller
@RequestMapping("/infoMessage/*")
public class InfoMessageAction extends DefaultAction{
    Logger logger = Logger.getLogger(InfoMessageAction.class);

    @Resource
    private IInfoMessageService infoMessageService;

    @ResponseBody
    @RequestMapping(value="selectUserBack", method= RequestMethod.GET,produces="application/json;charset=UTF-8")
    public Map selectUserBack(HttpServletRequest request) {
        try{
            Map params=getParameterMap(request);
            insertAccessinfo(request,"首页用户反馈");
            return this.infoMessageService.selectUserBack(params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error("用户反馈信息查询失败：",e);
            return null;
        }
    }

    @ResponseBody
    @RequestMapping(value="selectCount", method= RequestMethod.GET,produces="application/json;charset=UTF-8")
    public Integer selectCount(HttpServletRequest request) {
        try{
            Map params=getParameterMap(request);
            return this.infoMessageService.selectCount(params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error("用户反馈信息总条数查询失败：",e);
            return 0;
        }
    }

    @Override
    public String getText() {
        return null;
    }
}
